package com.airticketbooking.controller.user;

import com.airticketbooking.common.domain.R;
import com.airticketbooking.po.DiscountType;
import com.airticketbooking.service.DiscountTypeService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mr.J
 * @version 1.0.0
 * @date 2024/11/13
 * @desc
 */

@RequestMapping("air/user/discount")
@RestController
@Api(tags = "用户端折扣相关接口")
@RequiredArgsConstructor
@Slf4j
public class DiscountTypeController {

	 private final DiscountTypeService discountTypeService;

	//根据用户积分查询折扣类型
	@GetMapping("/getByPoint")
	public R<DiscountType> getByPoint(Integer orderId) {


		try {
			DiscountType discountType = discountTypeService.getByPoint(orderId);
			return R.ok(discountType);
		} catch (Exception e) {

			return R.error(e.getMessage());
		}
	}


}
